<!-- 超出内容省略 -->
<template>
  <view
    :class="{ line: props.row === 1, lines: props.row > 1 }"
    :title="props.hoverTip ? props.content : null"
    :style="{ '--row': props.row }"
  >
    <slot name="pre"></slot>
    {{ props.content }}
    <slot name="aft"></slot>
  </view>
</template>
<script setup lang="ts">
  const props = defineProps({
    row: {
      type: Number,
      default: 1,
    },
    hoverTip: {
      type: Boolean,
      default: false,
    },
    content: {
      type: String,
      default: '',
    },
  });
</script>
<style scoped lang="scss">
  .line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .lines {
    display: -webkit-box;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: var(--row);
    -webkit-box-orient: vertical;
  }
</style>
